﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class omos : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        loadModules();
        loadAbouts();
    }
    protected void loadModules()
    {
        phd_menu.Controls.Clear();
        UserControl uc = (UserControl)LoadControl("./modules/menu.ascx");
        phd_menu.Controls.Add(uc);

        /*phd_banner.Controls.Clear();
        UserControl uc_banner = (UserControl)LoadControl("./modules/banner.ascx");
        phd_banner.Controls.Add(uc_banner);

        phd_search.Controls.Clear();
        UserControl uc_search = (UserControl)LoadControl("./modules/search.ascx");
        phd_search.Controls.Add(uc_search);

        /*phd_flash_logo.Controls.Clear();
        UserControl uc_flash_logo = (UserControl)LoadControl("./modules/flash_logo.ascx");
        phd_search.Controls.Add(uc_flash_logo);*/

        /* phd_foreside_content.Controls.Clear();
         UserControl uc_foreside_content = (UserControl)LoadControl("./modules/foreside_content.ascx");
         phd_foreside_content.Controls.Add(uc_foreside_content);*/
    }
    protected void loadAbouts() {
        string query = "SELECT * FROM mwc_about_us WHERE enable = 1";
        SqlConnection sc = new SqlConnection(ConfigurationSettings.AppSettings["mwc_con"]);
        sc.Open();
        SqlCommand scmd = new SqlCommand(query,sc);
        SqlDataReader sdr = scmd.ExecuteReader();
        int i = 1;
        while (sdr.Read()) {
            if (i == 1) {
                about_img_1.ImageUrl = sdr["image"].ToString();
                about_name_1.Text = sdr["name"].ToString();
                about_pos_1.Text = sdr["position"].ToString();
                about_intro_1.Text = sdr["introtext"].ToString();
            }
            if (i == 2)
            {
                about_img_2.ImageUrl = sdr["image"].ToString();
                about_name_2.Text = sdr["name"].ToString();
                about_pos_2.Text = sdr["position"].ToString();
                about_intro_2.Text = sdr["introtext"].ToString();
            }
            i++;
        }
    }
}
